<HTML>
<HEAD>
<TITLE>TSP (libtsp) - AFsetNHpar</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFACD">
<H2>AFsetNHpar</H2>
<HR>
<H4>Routine</H4>
<DL>
<DT>
int AFsetNHpar (const char String[])
</DL>
<H4>Purpose</H4>
<DL>
<DT>
Set defaults for input headerless audio files from a string specification
</DL>
<H4>Description</H4>
This routine sets the default audio file data parameters.  These parameters
are used for reading audio files with unrecognized (non-standard) headers
or files with no headers (raw audio files).  This routine must be called
before opening the file with AFopnRead.  The parameters for AFsetNHpar are
determined from an input string which consists of a list of parameters
separated by commas and/or white space.  The form of the list is
<PRE>
  "Format, Start, Sfreq, Swapb, Nchan, ScaleF"
</PRE>
<DL>
<DT>
Format: File data format
<DD>
<PRE>
 "undefined" - Headerless files will be rejected
 "mu-law8"   - 8-bit mu-law data
 "A-law8"    - 8-bit A-law data
 "unsigned8" - offset-binary 8-bit integer data
 "integer8"  - two's-complement 8-bit integer data
 "integer16" - two's-complement 16-bit integer data
 "integer24" - two's-complement 24-bit integer data
 "integer32" - two's-complement 32-bit integer data
 "float32"   - 32-bit floating-point data
 "float64"   - 64-bit floating-point data
 "text"      - text data
</PRE>
<DT>
Start: byte offset to the start of data (integer value)
<DT>
Sfreq: sampling frequency in Hz (floating-point number)
<DT>
Swapb: Data byte swap parameter
<DD>
<PRE>
 "native" - no byte swapping
 "little-endian" - file data is in little-endian byte order and
    will be swapped if the current host uses big-endian byte order
 "big-endian" - data is in big-endian byte order and will be
    swapped swapped if the current host uses little-endian byte
    order
 "swap" - swap the data bytes
</PRE>
<DT>
Nchan: number of channels
<DD>
The data consists of interleaved samples from Nchan channels
<DT>
ScaleF: Scale factor
<DD>
<PRE>
 "default" - Scale factor chosen appropriate to the type of data. The
    scaling factors shown below are applied to the data in the file.
    8-bit mu-law:    1
    8-bit A-law:     1
    8-bit integer:   128
    16-bit integer:  1
    24-bit integer:  1/256
    32-bit integer:  1/65536
    float data:      32768
 "&lt;number or ratio&gt;" - Specify the scale factor to be applied to
    the data from the file.
</PRE>
</DL>
The default values for the audio file parameters correspond to the following
string.
<PRE>
  "undefined, 0, 8000., native, 1, default"
</PRE>
<P>
Leading and trailing white-space (as defined by isspace) is removed from
each item.  Any of the parameters may be omitted, in which case whatever
value has been previously set remains in effect for that parameter.  The
string ",512, 10000." would set the Start and Sfreq parameters and leave
the other parameters undisturbed.
<P>
If the input string contains has a leading '$', the string is assumed to
specify the name of an environment variable after the '$'.  This routine uses
the value of this environment variable to determine the parameters.  If this
routine is called as AFsetNHpar("$AF_NOHEADER"), this routine would look for
the parameter string in environment variable AF_NOHEADER.
<H4>Parameters</H4>
<DL>
<DT>
&lt;-  int AFsetNHpar
<DD>
Error flag, zero for no error
<DT>
 -&gt; const char String[]
<DD>
String containing the list of parameters for headerless files or the name
of an environment variable (with a leading $)
</DL>
<H4>Author / revision</H4>
P. Kabal
/ Revision 1.54  2009/03/01
<H4>See Also</H4>
<A HREF="AFopnRead.html">AFopnRead</A>
</BODY>
</HTML>
